# -*- coding: utf-8 -*-

"""
Time    :2021/6/21 下午9:17
Author  :chenyang
Email   :chenyang.it@outlook.com
FileName: decorators.py
Software: PyCharm
"""
from flask import session, redirect, url_for
from functools import wraps


def login_required(func):
    @wraps(func)
    def inner(*args, **kwargs):
        if 'uid' in session:
            return func(*args, **kwargs)
        else:
            return redirect(url_for('admin.login'))
    return inner
